package com.collections.www.zuoye;

import java.util.*;

public class Test01 {
    public static void main(String[] args) {
        //test01();
        test02();
    }
    public static void test02(){
        List<Student>list=new ArrayList<>();
        Map map=new HashMap();
        StudentRandom studentRandom= new StudentRandom();
        list.add(studentRandom.random());
        list.add(studentRandom.random());
        list.add(studentRandom.random());

        Iterator iterator=list.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }


    }
    public static void test01(){
        Map map1=new HashMap();
        map1.put(1,new Student("zhangsan","nan",18));
        Map map2=new HashMap();
        map2.put(2,new Student("lisi","nan",18));
        Map map3=new HashMap();
        map3.put(2,new Student("wangwu","nan",18));


       List <Map>list=new LinkedList<>();
        list.add(map1);
        list.add(map2);
        list.add(map3);

        Iterator iterator=list.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }

    }
}
class StudentRandom{
    public StudentRandom() {

    }

    public Student random(){
         Random random=new Random();
         Student student=new Student();
         student.name=random.toString();
         student.sex=random.toString();
         student.score=random.nextInt();

         return student;
     }
}
class Student{
    String name;
    String sex;
    int score;


    public String toString() {
        return "Student{" +
                "Name='" + name + '\'' +
                ", Sex='" + sex + '\'' +
                ", score=" + score +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public Student(String name, String sex, int score) {

        this.name = name;
        this.sex = sex;
        this.score = score;
    }

    public Student() {

    }
}
